home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-08 | 41.6 KB | 1,225 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Thu, 22 Oct 92 Volume 1 : Issue 196
-
- Today's Topics:
-
- Free Code: Watch Cursors
- More free code: Simplifying the List Manager
- Need sample code of MPW tool using Apple Events
- What is the bandwidth of a CableTV channel?
- PaintBehind (was Re: NON-QUICKDRAW GAMES)
- List fields...
- Color Icons
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. (This means you can't post questions to the
- digest.)
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- cs.uoregon.edu). Article threads are not added to the digest until the last
- article added to the thread is at least one month old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
- [128.223.8.8] in the directory /pub/mac/csmp-digest. Be sure to read the
- file /pub/mac/csmp-digest/README before downloading any files. The most
- recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
- directory /info-mac/digest/csmp. If you don't have ftp capability, the sumex
- archive has a mail server; send a message with the text '$MACarch help' (no
- quotes) to LISTSERV@ricevm1.rice.edu for more information.
-
- The digest is also available via email. Just send a note saying that you
- want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
- automatically receive each new issue as it is created. Sorry, back issues
- are not available through the mailing list.
-
- Send administrative mail to mkelly@cs.uoregon.edu.
-
-
- -------------------------------------------------------
-
- From: kurisuto@BACH.UDEL.EDU ("Sean J. Crist")
- Subject: Free Code: Watch Cursors
- Date: 18 Sep 92 02:30:01 GMT
-
-
- The following free code is nothing particularly complicated or
- unusual; it simply handles the work involved in showing watch cursors,
- either with spinning or non-spinning hands. I'm posting it here because
- it may be helpful to new programmers, or
- because it might save someone else the time of writing it over again.
- This code was written in Think Pascal 4.0.
-
- How to use this code:
- 1. Use ResEdit to copy the seven CURS resources from the Finder into your
- application's resource file. I lifted mine from 6.1.5 where they were
- numbered beginning at 257. I'm not sure whether or not these resource
- numbers are the same under all
- versions of the Finder; if yours are different, you will have to either
- change the resource numbers or the code below.
- Also, I don't know how Apple feels about people stealing their
- cursors. However, since these seven CURS resources are a standard part of
- the user interface, and since they are a minor part of the Finder, I doubt
- that Apple is going to sue you for
- using them.
-
- 2. Include the global variables in the code below in your program's
- global declarations.
-
- 3. When your program initializes itself on startup, it should call
- InitWatch once. Alternately, you could eliminate this routine and paste
- its one line of code into your own initialize routine.
-
- 4. To show a simple still watch, call ShowWatch. This routine is
- functionally equivalent to InitCursor.
-
- 5. To make the hands of the watch actually spin, don't call ShowWatch.
- Instead, start the watch spinning by calling StartSpinningWatch. While
- you are doing your time-consuming processing, call SpinWatch as often as
- possible (perhaps by including it in
- some inner processing loop). SpinWatch takes care of the timing involved
- in spinning the watch hands; all you have to do is call it as often as
- possible.
-
- 6. When you are finished spinning the watch hands, be sure to call
- StopSpinningWatch. This deallocates the memory associated with the watch
- cursors.
-
- 7. This code spins the watch handle every 30 ticks (once every half
- second). To change this speed, edit the figure 30 in the SpinWatch
- routine. (I don't know whether Apple has established any guideline for
- how often a cursor should spin.)
-
- Please send bug reports, praise, etc. to kurisuto@bach.udel.edu. I hope
- this code is useful to somebody.
-
- unit SpinningWatch;
-
- interface
-
- {Global variables}
- var
- gWatchHandle: CursHandle;
- gSpinningWatchHandle: array[1..8] of CursHandle;
- gSpinningWatchTimer: LongInt;
- gSpinningWatchState: Integer;
-
- {Call this at the beginning of your program.}
- procedure InitWatch;
-
- {Call ShowWatch as you would InitCursor.}
- procedure ShowWatch;
-
- {This routine is called when we want to first start displaying the moving
- watch cursor.}
- procedure StartSpinningWatch;
-
- {This routine is called when we want to rotate the watch to the next
- position. We should}
- {just call this routine as often as possible; this routine worries about
- the timing itself.}
- procedure SpinWatch;
-
- {This routine deallocates the memory we used and inits the cursor.}
- procedure StopSpinningWatch;
-
- implementation
-
- procedure InitWatch;
- begin
- {Get a handle to that standard watch cursor and hold on to it for the rest
- of the program.}
- gWatchHandle := GetCursor(WatchCursor);
- end;
-
-
- procedure ShowWatch;
- {Set cursor to watch}
- {We have no routine ShowPointer, because we can simply say InitCursor.}
- begin
- SetCursor(gWatchHandle^^);
- end;
-
- {This routine is called when we first start want to display the moving
- watch cursor.}
- procedure StartSpinningWatch;
- var
- counter: Integer;
- begin
- for counter := 1 to 7 do
- gSpinningWatchHandle[counter] := GetCursor(Counter + 256);
- gSpinningWatchState := 8;
- gSpinningWatchTimer := TickCount;
- end;
-
- {This routine is called when we want to rotate the watch to the next
- position. We should}
- {just call this routine as often as possible; this routine worries about
- the timing.}
- procedure SpinWatch;
- var
- NewTime: LongInt;
- begin
- NewTime := TickCount;
- if (NewTime - 30) > gSpinningWatchTimer then
- begin
- gSpinningWatchState := gSpinningWatchState + 1;
- gSpinningWatchTimer := NewTime;
- if gSpinningWatchState > 8 then
- gSpinningWatchState := 1;
- if gSpinningWatchState = 8 then
- ShowWatch
- else
- SetCursor(gSpinningWatchHandle[gSpinningWatchState]^^);
- end;
- end;
-
- {This routine deallocates the memory we used and inits the cursor.}
- procedure StopSpinningWatch;
- var
- counter: Integer;
- begin
- for counter := 1 to 7 do
- ReleaseResource(Handle(gSpinningWatchHandle[counter]));
- end;
-
- end.
-
-
-
-
- ---------------------------
-
- From: kurisuto@BACH.UDEL.EDU ("Sean J. Crist")
- Subject: More free code: Simplifying the List Manager
- Date: 18 Sep 92 03:33:13 GMT
-
-
- The following code, once again, is nothing particularly glamorous; it
- simply makes it easier to use the List Manager to create and manage lists
- of strings. One of the most common uses for the List Manager is
- scrollable, one-dimensional, fixed-size
- lists of strings (as in SFGetFile, SFPutFile). The List Manager is good
- for creating all kinds of lists (such as lists of icons), but a lot of
- this functionality is a hassle for programmers who only need a simple list
- of strings.
- The code below allows you create and dispose of lists of strings. It
- allows you to add, rename, and remove elements in the list, and handles
- mouse clicks and update events. It also keeps the lists in alphabetical
- order.
- I remember having a lot of trouble learning how to call the List
- Manager properly; I hope that this code helps somebody else.
-
- How to use these routines:
- Every one of these routines takes a ListHandle as one of its
- parameters. It is OK to have several lists going at one time; just make
- sure you pass the right ListHandle when you call one of these routines.
-
- CreateList: Call this routine to create a new list of strings. Pass it
- an empty ListHandle, as well as the pointer to the window to contain the
- list, and the rectangle in which the list should be enclosed. The list
- can take up an entire window, or only
- part of it, as you prefer. The scroll bar will be drawn inside the
- rectangle you specify, so you don't need to leave extra room for it.
- Initially, the list will contain no strings.
-
- UpdateList: Call this in response to an Update event to redraw the
- portions of the list which need it. This routine assumes that you have
- already called BeginUpdate for the window containing the list, and that
- you have not yet called EndUpdate.
-
- DoClick: Call this function in response to a MouseDown event inside your
- list's rectangle. DoClick usually returns FALSE, but it returns TRUE if
- this click is the second click of a double-click (i.e., TRUE means the
- user double-clicked an item).
-
- TurnOffSelection: This routine unhilights the currently hilighted cell,
- if any.
-
- ListSelection: This returns the string of the currently selected cell.
- If no cell is currently selected, the empty string is returned.
-
- AddCell: Call this routine to add a new cell to the list. The string you
- pass to this routine is automatically alphabetized within the list. Bug
- alert: the first element or two of the list are sometimes not in
- alphabetical order. If you take the time
- to work out this kink, please let me know what you did (I could figure
- this out, but I just haven't taken the time to). This bug is cosmetic and
- does not crash the program.
-
- RenameCell: Changes the string in a cell to another string, and
- realphabetizes the list, if necessary.
-
- DeleteCell: Removes the cell with the given string from the list.
-
- DisposList: Call this routine when you are completely finished with a
- list and want to deallocate its memory.
-
- Credit: The routines CreateList, UpdateList, DoClick, and DisposList
- are loosely based on some code I received from somebody of
- comp.sys.mac.programmer around two years ago. I've rewritten these
- routines, but credit is due to this contributor, whose
- name I cannot remember.
-
- I have successfully called these routines for lists in regular
- windows as well as in modal dialogs. Please send bug reports, praise,
- money, etc. to kurisuto@bach.udel.edu.
-
- unit StringListInterface;
-
- interface
-
- {Create a new list with no elements.}
- procedure CreateList (var TheListHandle: ListHandle; TheWindow:
- WindowPtr; TheRect: Rect);
-
- {Update the art of a list.}
- procedure UpdateList (TheListHandle: ListHandle);
-
- {Handle a click in the list rectangle. If it was a double-click, we will
- return TRUE.}
- function DoClick (TheListHandle: ListHandle; TheWhere: Point): Boolean;
-
- {Turn off any hilited item.}
- procedure TurnOffSelection (TheListHandle: ListHandle);
-
- {Return the string currently selected; empty string if no selection.}
- function ListSelection (TheListHandle: ListHandle): string;
-
- {Add a new cell containing the string parameter to the end of the list}
- procedure AddCell (TheListHandle: ListHandle; NewString: str255);
-
- {Change the name of an existing cell}
- procedure RenameCell (TheListHandle: ListHandle; OldString, NewString:
- Str255);
-
- {Remove the cell with the given name from the list.}
- procedure DeleteCell (TheListHandle: ListHandle; TheString: string);
-
- {Get rid of the list when we're done with it, cleaning up all the memory.}
- procedure DisposList (TheListHandle: ListHandle);
-
- implementation
-
- procedure CreateList;
- const
- StandardList = 0;
- var
- ViewRect: Rect;
- DataBounds: Rect;
- CellSize: Point;
- TempInteger: Integer; {Just to do a little math}
- begin
- {Inset the box to make room for the scroll bar. Also inset it so we've
- got room for a border.}
- ViewRect := TheRect;
- InsetRect(ViewRect, 1, 1);
- ViewRect.Right := ViewRect.Right - 15;
- {Set the cell size to the size of the cell}
- CellSize.v := TheWindow^.txSize + 3;
- if CellSize.v = 3 then {If it hasn't been set, then make it 12 point.}
- begin
- TextSize(12);
- CellSize.v := 15;
- end;
- CellSize.h := ViewRect.Right - ViewRect.Left;
- {Now adjust the ViewRect to avoid cutting off the last visible cell}
- TempInteger := (ViewRect.Bottom - ViewRect.Top) div CellSize.v;
- ViewRect.Bottom := ViewRect.Top + (TempInteger * CellSize.v);
- {Create the new list.}
- SetRect(DataBounds, 0, 0, 1, 0);
- TheListHandle := LNew(ViewRect, DataBounds, CellSize, StandardList,
- TheWindow, FALSE, FALSE, FALSE, TRUE);
- UpdateList(TheListHandle);
- end;
-
- {Update the display of a list.}
- procedure UpdateList;
- var
- ViewRect: Rect;
- ListUpdateRgn: RgnHandle;
- begin
- SetPort(TheListHandle^^.Port);
- {Get the List manager to update the list.}
- ViewRect := TheListHandle^^.rView;
- LDoDraw(true, TheListHandle);
- ListUpdateRgn := NewRgn;
- RectRgn(ListUpdateRgn, ViewRect);
- LUpdate(ListUpdateRgn, TheListHandle);
- {Draw the border}
- InsetRect(ViewRect, -1, -1);
- FrameRect(ViewRect);
- {Clean up after ourselves}
- DisposeRgn(ListUpdateRgn);
- end;
-
- {Handle a click in the list rectangle. If it was a double-click, we will
- return TRUE.}
- function DoClick;
- begin
- SetPort(TheListHandle^^.Port);
- LDoDraw(TRUE, TheListHandle);
- DoClick := LClick(TheWhere, 0, TheListHandle);
- end;
-
- {Turn off any hilited item.}
- procedure TurnOffSelection;
- var
- ResultPoint: Point;
- begin
- SetPt(ResultPoint, 0, 0);
- if LGetSelect(TRUE, ResultPoint, TheListHandle) then
- LSetSelect(FALSE, ResultPoint, TheListHandle);
- end;
-
- {Return the string currently selected; empty string if no selection.}
- function ListSelection;
- var
- ResultPoint: Point;
- ResultString: Str255;
- StringPointer: Ptr;
- StringLength: Integer;
- begin
- SetPt(ResultPoint, 0, 0);
- if LGetSelect(TRUE, ResultPoint, TheListHandle) then
- {If there is a cell selected, then get the string value of that string.
- There ought to be an}
- {easier way to do this than mucking around in the memory like this. >:-(
- }
- begin {If there is a cell selected, then return the string of the cell.}
- StringPointer := Ptr(Ord(@ResultString) + 1);
- StringLength := 255; {This is the maximum amount of data we are
- allowed to move.}
- LGetCell(StringPointer, StringLength, ResultPoint, TheListHandle);
- StringPointer := Ptr(Ord(@ResultString));
- StringPointer^ := StringLength;
- ListSelection := ResultString;
- end
- else {Otherwise, return the empty string to show that nothing is selected.}
- ListSelection := '';
- end;
-
- {Add a new cell containing the string parameter to the end of the list}
- procedure AddCell;
- var
- Counter: Integer;
- CellPoint: Point;
- OldString: Str255;
- CompResult: Integer;
- StringLength: Integer;
- StringPointer: Ptr;
- done: Boolean;
- begin
- {Step 1: Circle through the loop and figure out where we should insert
- the new}
- {cell. We do this to put the list in alphabetical order, and to keep it
- that way as}
- {new items are added.}
- CellPoint.h := 0;
- CellPoint.v := 0;
- Done := false;
- while not done do
- begin
- if LNextCell(TRUE, TRUE, CellPoint, TheListHandle) then
- begin
- StringPointer := Ptr(Ord(@OldString) + 1);
- StringLength := 255; {This is the maximum amount of data we are
- allowed to move.}
- LGetCell(StringPointer, StringLength, CellPoint, TheListHandle);
- StringPointer := Ptr(Ord(@OldString));
- StringPointer^ := StringLength;
- {Now, compare the new string with the contents of the cell and decide
- whether the new string}
- {should come before or after this cell.}
- CompResult := RelString(NewString, OldString, false, true);
- case CompResult of
- sortsBefore, sortsEqual:
- done := true;
- SortsAfter:
- ;
- end;
- end
- else
- {There are no more rows, so that's all.}
- begin
- done := true;
- end;
- end;
-
- {Add the new row at the top of the list.}
- CellPoint.v := LAddRow(1, CellPoint.v, TheListHandle);
- {Put the string into the cell. Once again, there ought to be an easier
- way to do this.}
- LSetCell(Pointer(Ord(@NewString) + 1), Length(NewString), CellPoint,
- TheListHandle);
- end;
-
-
- procedure RenameCell;
- var
- CellPoint: Point;
- DataPtr: Ptr;
- DataLen: Integer;
- begin
- SetPt(CellPoint, 0, 0);
- DataPtr := Pointer(Ord(@OldString) + 1);
- dataLen := Length(OldString);
- if LSearch(dataPtr, dataLen, nil, CellPoint, TheListHandle) then
- begin
- DataPtr := Pointer(Ord(@NewString) + 1);
- dataLen := Length(NewString);
- LSetCell(DataPtr, dataLen, CellPoint, TheListHandle);
- end
- else
- begin
- {The programmer asked us to rename a cell which doesn't exist. We'll just
- beep angrily}
- {three times. It's the programmer's responsibility to see that the cell
- in question actually}
- {does exist before calling this routine.}
- Sysbeep(1);
- Sysbeep(1);
- Sysbeep(1);
- end;
- end;
-
-
- {Remove the cell with the given name from the list.}
- procedure DeleteCell;
- var
- CellPoint: Point;
- DataPtr: Ptr;
- DataLen: Integer;
- begin
- SetPt(CellPoint, 0, 0);
- DataPtr := Pointer(Ord(@TheString) + 1);
- dataLen := Length(TheString);
- if LSearch(dataPtr, dataLen, nil, CellPoint, TheListHandle) then
- begin
- LDelRow(1, CellPoint.v, TheListHandle);
- end
- else
- begin
- {The programmer asked us to delete a cell which doesn't exist. We'll just
- beep angrily}
- {three times. It's the programmer's responsibility to see that the cell
- in question actually}
- {does exist before calling this routine.}
- Sysbeep(1);
- Sysbeep(1);
- Sysbeep(1);
- end;
- end;
-
- {Get rid of the list when we're done with it, cleaning up all the memory.}
- procedure DisposList;
- begin
- LDispose(TheListHandle);
- end;
-
-
- end.
-
- ---------------------------
-
- From: tomc@oakhill.sps.mot.com (Tom Cunningham)
- Subject: Need sample code of MPW tool using Apple Events
- Date: 17 Sep 92 18:18:19 GMT
- Organization: Motorola Inc., Austin, Tx
-
-
- Does anyone have some code for an MPW tool using Apple Events that
- they could send me? In particular, I want to communicate with the
- Tool Server (e.g. run a script) via Apple Events from within an MPW
- tool. Thanks.
- - --
- Tom Cunningham Motorola Inc. Austin TX
- tomc@dsp.sps.mot.com
- cs.utexas.edu!oakhill!dsp!bouwsma!tomc
-
- +++++++++++++++++++++++++++
-
- From: keith@taligent.com (Keith Rollin)
- Organization: Taligent
- Date: Fri, 18 Sep 1992 01:50:18 GMT
-
- In article <1992Sep17.181819.23018@oakhill.sps.mot.com>,
- tomc@oakhill.sps.mot.com (Tom Cunningham) wrote:
- >
- >
- > Does anyone have some code for an MPW tool using Apple Events that
- > they could send me? In particular, I want to communicate with the
- > Tool Server (e.g. run a script) via Apple Events from within an MPW
- > tool. Thanks.
-
- I used the following in a tool I wrote to kill and restart the Finder. This
- was in the hopes that shutting down the Finder would help speed up my long
- compiles (it didn't). Remember that you have to have one of the MPW Shells
- that comes with its High-Level Event Aware bit set:
-
- void KillFinder()
- {
- OSErr err;
- OSType signature = 'MACS';
- AEAddressDesc target;
- AppleEvent theEvent;
- Str255 s;
- ProcessSerialNumber pPsn;
-
- err = FindProcessBySignature(signature, &pPsn);
- if (err == noErr) {
- err = AECreateDesc(typeProcessSerialNumber, (Ptr) &pPsn, sizeof(pPsn),
- &target);
- if (err == noErr) {
- err = AECreateAppleEvent('aevt', 'quit', &target,
- kAutoGenerateReturnID, kAnyTransactionID, &theEvent);
- if (err == noErr) {
- err = AESend(&theEvent, nil, kAENoReply, kAENormalPriority, kNoTimeOut,
- nil, nil);
- if (err != noErr) {
- fprintf(stderr, "### - Error while trying to send Apple Event.\n");
- GetSysErrText(err, s);
- fprintf(stderr, "### %s.\n", s);
- exit(kBadAESend);
- }
- } else {
- fprintf(stderr, "### - Error while trying to create Apple Event.\n");
- GetSysErrText(err, s);
- fprintf(stderr, "### %s.\n", s);
- exit(kBadAppleEvent);
- }
- } else {
- fprintf(stderr, "### - Error while trying to create Finder address.\n");
- GetSysErrText(err, s);
- fprintf(stderr, "### %s.\n", s);
- exit(kBadAddress);
- }
- } else {
-
- +++++++++++++++++++++++++++
-
- From: ksand@apple.com (Kent Sandvik)
- Date: 18 Sep 92 22:22:53 GMT
- Organization: Apple
-
- In article <1992Sep17.181819.23018@oakhill.sps.mot.com>,
- tomc@oakhill.sps.mot.com (Tom Cunningham) wrote:
- > Does anyone have some code for an MPW tool using Apple Events that
- > they could send me? In particular, I want to communicate with the
- > Tool Server (e.g. run a script) via Apple Events from within an MPW
- > tool. Thanks.
-
- The System 7 CD had an MPW tool called SendAE that you could use.
- The AEs for Toolserver are documented in the Toolserver Release
- Notes.
-
- Finally, the Developer CD should have a lot of small AE snippets
- could reused for AE code.
-
- Kent/DTS
-
- "You should really just relax" -MST3K
- - -------------------
- Kent Sandvik (UUCP: ....!apple!ksand; INTERNET: ksand@apple.com)
- DISCLAIMER: Private activities on the Net.
-
- ---------------------------
-
- From: mxmora@unix.sri.com (Matthew Xavier Mora)
- Subject: What is the bandwidth of a CableTV channel?
- Date: 17 Sep 92 17:51:58 GMT
- Organization: SRI International
-
- This question probably doesn't belong here but I figure this is the
- smartest group on the net anyway so you might know. :-)
-
- What is the bandwidth of a cable tv channel and could ethernet pass through
- it? How about appletalk? You see what I'm getting at don't you. :-)
-
- Thanks
-
- Matt
-
- +++++++++++++++++++++++++++
-
- From: Anders Wallgren <anders@verity.com>
- Organization: Verity, Mountain View, CA, USA
- Date: Fri, 18 Sep 92 03:18:52 GMT
-
- In article <mxmora-170992105130@css-mac1.sri.com> Matthew Xavier
- Mora, mxmora@unix.sri.com writes:
- >What is the bandwidth of a cable tv channel and could ethernet
- pass through
- >it? How about appletalk? You see what I'm getting at don't you. :-)
-
- Well, one NTSC TV channel is 6MHz, so assume a 100 channel capacity
- (perhaps generous, but it makes the math easier), which means
- something like 600MHz.
-
- anders
-
- +++++++++++++++++++++++++++
-
- From: beckett@ctrvax.vanderbilt.edu (Robert Beckett)
- Date: 18 Sep 92 16:32:35 GMT
- Organization: Vanderbilt University Computer Center
-
- In article <mxmora-170992105130@css-mac1.sri.com>, mxmora@unix.sri.com
- (Matthew Xavier Mora) wrote:
- >
- > This question probably doesn't belong here but I figure this is the
- > smartest group on the net anyway so you might know. :-)
- >
- > What is the bandwidth of a cable tv channel and could ethernet pass through
- > it? How about appletalk? You see what I'm getting at don't you. :-)
- >
-
- On our braodband, cable TV and data channels co-exist. Cable TV channels
- are 6Mhz wide. We have AppliTeks which have send and receive channels,
- each of which is 6Mhz wide. We also have Chipcoms which use 12Mhz channels
- that somehow manage to send and receive. So it appears that if you wish to
- do full ethernet on cable, you need to set aside 2 cable channels to do it.
- I am no networking expert, but this is my understanding of the situation
- here.
-
- I am reminded somehow of the old Sony PCM F1 digital audio processor, which
- allowed one to record full 16bit/44.056Khz 2 channel audio (about 1.4 Mb/s)
- onto regular VHS or Beta VCR's. Of course, Ethernet (at 10 Mb/s) is much
- faster.
-
-
- - --Robert BECKETT@ctrvax.vanderbilt.edu
- Vanderbilt University Computer Center
-
- +++++++++++++++++++++++++++
-
- From: potts@itl.itd.umich.edu (Paul Potts)
- Date: 18 Sep 92 20:10:16 GMT
- Organization: Instructional Technology Laboratory, University of Michigan
-
- In article <beckett-180992111912@sdvmac1.cc.vanderbilt.edu> beckett@ctrvax.vanderbilt.edu (Robert Beckett) writes:
- >In article <mxmora-170992105130@css-mac1.sri.com>, mxmora@unix.sri.com
- >(Matthew Xavier Mora) wrote:
- >>
- >> This question probably doesn't belong here but I figure this is the
- >> smartest group on the net anyway so you might know. :-)
- >>
- >> What is the bandwidth of a cable tv channel and could ethernet pass through
- >> it? How about appletalk? You see what I'm getting at don't you. :-)
- >>
- >
- >On our braodband, cable TV and data channels co-exist. Cable TV channels
- >are 6Mhz wide. We have AppliTeks which have send and receive channels,
- >each of which is 6Mhz wide. We also have Chipcoms which use 12Mhz channels
- >that somehow manage to send and receive. So it appears that if you wish to
- >do full ethernet on cable, you need to set aside 2 cable channels to do it.
- > I am no networking expert, but this is my understanding of the situation
- >here.
-
- We had a similar system back at the College of Wooster... there was a
- cable TV plant campus-wide, and ChipCom boxes which passed Ethernet
- over a couple of channels of the cable TV plant. It can be done without
- too much trauma, although as I recall the boxes were quite expensive.
- I don't know what the performance of the ChipComs were (they were called
- EtherModems, I believe) but there didn't seem to be any noticeable bottleneck
- when going from an Ethernet over the cable plant and back to another Ethernet.
-
-
- - --
- "...remove protective cap. Hold atomizer with thumb at base and nozzle
- between first and second fingers. Without tilting head, insert nozzle into
- nostril. Fully depress rim with a firm, even stroke and sniff deeply."
- - -advice for presidential candidates from Paul Potts - potts@itl.itd.umich.edu
-
- +++++++++++++++++++++++++++
-
- From: lederman@taney.uscghq.uscg.mil
- Date: 18 Sep 92 14:19:01 GMT
- Organization: United States Coast Guard
-
- In article <mxmora-170992105130@css-mac1.sri.com>, mxmora@unix.sri.com (Matthew Xavier Mora) writes:
- > What is the bandwidth of a cable tv channel and could ethernet pass through
- > it? How about appletalk? You see what I'm getting at don't you. :-)
-
- The bandwidth of a single TV channel (cable, or anywhere else)
- is 6 MHz. The bandwidth of the entire cable system is severawl
- hundred MHz.
-
- Ethernet is up to 10 million bits per second. There are
- already companies which make "translators" to transport ethernet
- on a Cable TV cable. I think it uses more than one channel.
-
- Appletalk on a local talk cable is somwhere around 233 k BPS.
- I don't know any commercial hardware to transport it on a cable
- network, but there may well be some. (I built some hardware that
- would do stuff like this for my Masters of Engineering degree,
- but it never went commercial :-). I'm sure there is stuff to put
- medium speed channels on a Cable, but they're going to be in
- standard multiples (like 64k BPS, or 256k BPS).
-
- ---------------------------
-
- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
- Subject: PaintBehind (was Re: NON-QUICKDRAW GAMES)
- Date: 19 Sep 92 06:11:52 GMT
- Organization: University of Waikato, Hamilton, New Zealand
-
- In article <18qmi7INN12l@agate.berkeley.edu>, deadman@garnet.berkeley.edu (Ben Haller) writes:
- > In article <1992Sep11.184049.10764@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
- >>In article <18one7INNm74@agate.berkeley.edu>, deadman@garnet.berkeley.edu (Ben Haller) writes:
- >>> In article <ah5ywvd@rpi.edu> johnsd2@rpi.edu writes:
- >>> void InvalScreen()
- >>> {
- >>> DrawMenuBar();
- >>> PaintOne(0L,GrayRgn);
- >>> PaintBehind(WindowList,GrayRgn);
- >>> }
- >>
- >>The PaintOne call is redundant; PaintBehind does it all. Also, why refer
- >>to the WindowList when you can use FrontWindow?
- > The PaintOne call, if I recall correctly, repaints the desktop. This
- > would not be done by the PaintBehind call, as far as I know.
-
- I have an FKEY installed on my machine for refreshing the screen. It
- basically does a PaintBehind call. I never bothered with DrawMenuBar, since
- the menu bar gets redrawn on a major switch anyway.
-
- Every time I invoke this FKEY, I can see the Finder redrawing the icons on
- the desktop.
-
- Here, try it yourself:
-
- (This file must be converted with BinHex 4.0)
-
- Lawrence D'Oliveiro fone: +64-7-856-2889
- Computer Services Dept fax: +64-7-838-4066
- University of Waikato electric mail: ldo@waikato.ac.nz
- Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
-
- +++++++++++++++++++++++++++
-
- From: deadman@garnet.berkeley.edu (Ben Haller)
- Date: 18 Sep 92 17:04:59 GMT
- Organization: Stick Software
-
- In article <1992Sep18.181152.10862@waikato.ac.nz>
- ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
- [several levels of quoting and attribution have been removed; not all
- of this was written by Lawrence, some was written by me...]
- > void InvalScreen()
- > {
- > DrawMenuBar();
- > PaintOne(0L,GrayRgn);
- > PaintBehind(WindowList,GrayRgn);
- > }
- >
- >I have an FKEY installed on my machine for refreshing the screen. It
- >basically does a PaintBehind call. I never bothered with DrawMenuBar, since
- >the menu bar gets redrawn on a major switch anyway.
- >
- >Every time I invoke this FKEY, I can see the Finder redrawing the icons on
- >the desktop.
-
- Maybe the PaintOne is needed in System 6; this makes sense, since in
- System 7 the Desktop is really a window in the windowlist of the Finder.
- So I bet your FKEY wouldn't work in System 6.0.x (but I can't try it,
- not having a machine to try it on... anyone want to check & make sure?)
- I really feel fairly sure that the PaintOne is necessary for some
- reason...
- As for the DrawMenuBar call, well, not everyone calls this function
- immediately before generating a major context switch... screensavers
- being a good example...
-
- - -Ben Haller (deadman@garnet.berkeley.edu)
-
- ---------------------------
-
- From: rer@sun1x.res.utc.com (Rick E Romkey)
- Subject: List fields...
- Date: 17 Sep 92 12:06:45 GMT
- Organization: United Technologies Research Center
-
-
- I have been having some problems trying to figure out how
- to get a custom List working. Here's the scoop:
-
- I wanna place a '\n' delimited string into a field as separate
- cells. It should only allow a single field to be selected. I seem
- to have created the cells ok, but for the life of me, I can't
- get it to write within them.
-
- This field is part of a modal dialog (maybe a modeless someday,
- but for now I'll be happy with a modal). Anyone have some
- easy-to-follow source code?
-
- Rick E Romkey
-
- +++++++++++++++++++++++++++
-
- From: haynes@mace.cc.purdue.edu (Carl W. Haynes III)
- Date: 19 Sep 92 00:21:26 GMT
- Organization: Purdue University
-
- In article <1992Sep17.120645.19976@sun1x.actc.res.utc.com> rer@sun1x.res.utc.com (Rick E Romkey) writes:
- >
- >I wanna place a '\n' delimited string into a field as separate
- >cells. It should only allow a single field to be selected. I seem
- >to have created the cells ok, but for the life of me, I can't
- >get it to write within them.
- >
-
- In your LDEF Proc, you do all your drawing in when you get
- the lDrawMsg. lRect gives you the rect to draw into. to get the
- text of the cell you want to draw.
-
- here's an example LDEF that simply makes sure that the text is drawn
- in 12 point applFont. I ripped out a bunch of code that was specific
- to my application (I was doing some extra formatting), but everything
- should still work.
-
- Macintosh Programming Secrets (2nd edition) also has an example LDEF.
- I've always found the List Manager chapter of Inside Mac one of
- the better writtendefinately read through that again.
- The UseNet Macintosh Programmers Guide (available at the usual archives)
- also has an example LDEF.
-
- carl
-
- pascal void exampleLDEF( short lMessage,
- Boolean lSelect,
- Rect *lRect,
- Cell *lCell,
- short lDataOffset,
- short lDataLen,
- ListHandle lHandle)
- {
- char listState;
-
- listState = HGetState(lHandle);
- HLock(lHandle);
-
- switch (lMessage)
- {
- case lInitMsg:
- break;
- case lDrawMsg:
- {
- Rect tempRect;
- PenState savedPenState;
- short savedFont;
- short savedFontSize;
- Str255 cellContents;
-
- //
- // Save everything we can since we don't know
- // what we may be dealing with
- //
-
- GetPenState(&savedPenState);
- PenNormal();
-
- savedFont = (*(**lHandle).port).txFont;
- savedFontSize = (*(**lHandle).port).txSize;
-
- //
- // Set up things the way we like 'em
- //
-
- TextFont(applFont);
- TextSize(12);
-
- EraseRect(lRect);
-
- //
- // Write the text
- //
-
- BlockMove( &*(**lHandle).cells[0] + lDataOffset,
- cellContents,
- (Size)lDataLen);
-
- tempRect = *lRect;
- InsetRect(&tempRect, 2, 0);
- TextBox(cellContents, (long)lDataLen, &tempRect, teJustLeft);
-
- //
- // Invert it if necessary
- //
-
- if (lSelect)
- InvertRect(lRect);
-
- //
- // Set everything back
- //
-
- TextFont(savedFont);
- TextSize(savedFontSize);
- SetPenState(&savedPenState);
-
- break;
- }
- case lHiliteMsg:
- InvertRect(lRect);
- break;
- }
-
- HSetState(lHandle, listState);
- }
-
- ---------------------------
-
- From: bberqu@sagpd1
- Subject: Color Icons
- Date: 26 Aug 92 23:38:00 GMT
-
- Hi,
-
- I'm trying to create some color icons using ResEdit in 256 color mode, so
- I create the Icons with certain colors (like yellows/oranges ...) just
- fine, I copy them to the scrap and then paste them into the getinfo
- window, however, most of the (if not all) orange/yellow colors don't
- show up when the icon is pasted, all shades of the blues show up just
- fine. I also tried the apple colors pallete in ResEdit also with oranges
- and reds, still no success. I hope this isn't a FAQ, Any explanations
- would be appreciated.
-
- Programmers question:
-
- I'm trying to use ModalDialog with a filterProc function which will
- handle popupmenus, when I call ModalDialog and just let it sit there
- no mouse movement or anything, after a while, I get, I believe a system
- error #26 according to MacsBug, all my filter proc function does is
- return (TRUE), I've also tried FALSE. My impression from IM is that
- ModalDialog sits there and waits for a mousedown event within the dialog
- and when it gets either a itemhit or incontent or whatever, it then calls
- the filterProc function (if defined), is this true? I assume that it
- passes the dialog poointer/event record pointer/itemhit pointer, is this
- true? It looks like its calling my filterProc constantly, if this is true
- do I need handle events within the filterProc? Assuming all my parameters
- are correct for filterProc are correct, what am I doing wrong?
-
- An explanation of how ModalDialog and the filterProc functions work with
- each other would be nice.
-
- Thanks in advance
-
- Brian
-
- +++++++++++++++++++++++++++
-
- From: stepan@natinst.com (Stepan Riha)
- Date: 27 Aug 92 15:32:56 GMT
- Organization: National Instruments, Austin, TX
-
- In article <1992Aug26.233800.21347@sagpd1> bberqu@sagpd1 () writes:
-
- Q: Why does the finder change some colors when you paste a picture into the
- Get Info Window?
-
- When you paste a picture into the Get Info Window the finder maps the colors
- to the 34 Apple Icon Colors. You can set these in the cicn or icl8 dialog.
- If you REALLY want to have your specific colors, you can edit the custom icons
- directly in ResEdit once you paste them on your document in the GetInfo window.
- The icons have id -16455 and type icl8, icl4, ICN#, ics8, etc.
- Note that only colors from the Apple Icon Colors will by affected by the
- color of a label or when the icon is selected.
-
- - Stepan
- - --
- Stepan Riha -- stepan@natinst.com
-
- +++++++++++++++++++++++++++
-
- From: potts@itl.itd.umich.edu (Paul Potts)
- Date: 27 Aug 92 15:43:37 GMT
- Organization: Instructional Technology Laboratory, University of Michigan
-
- In article <1992Aug26.233800.21347@sagpd1> bberqu@sagpd1 () writes:
- ... stuff on color icons left out...
- >
- >Programmers question:
- >
- >I'm trying to use ModalDialog with a filterProc function which will
- >handle popupmenus, when I call ModalDialog and just let it sit there
- >no mouse movement or anything, after a while, I get, I believe a system
- >error #26 according to MacsBug, all my filter proc function does is
- >return (TRUE), I've also tried FALSE. My impression from IM is that
- >ModalDialog sits there and waits for a mousedown event within the dialog
- >and when it gets either a itemhit or incontent or whatever, it then calls
- >the filterProc function (if defined), is this true?
-
- Not quite. When you set up a filter procedure, ModalDialog
- sends all the events to it for screening before it looks at them.
- This includes idle events, if there are any: you can actually do things
- on idle time in your filter procedure, if you don't need any guarantee that
- you will get idle time (you wont' get it in a very busy system, at least
- not consistently).
-
- ModalDialog *always* quits when it gets one of its triggering events,
- like a keypress that it understands (return for the default button, for
- example), or a mouse click in a button or on a checkbox. If you have, say,
- ten check boxes and an OK button, and you want to keep the modal dialog up
- until the OK button is hit, you have to call ModalDialog in a loop which
- checks to see what was hit and only stops calling it if the OK button was
- hit.
-
- If you install a filter procedure, you return TRUE if you want ModalDialog
- to quit. You have the event that got passed to your filter proc, so you
- can change it if you want. You have a pointer to the item ID that ModalDialog
- should return. Here's a diagram:
-
- Without a filter proc (actually with the default filter proc)
-
- - ---> event---> ModalDialog ---------> exit (return the item that was hit
- Was a triggering to dismiss the dialog)
- event received?
-
-
- With a filter proc
-
- - ---> event---> FilterProc ----> ModalDialog ----> exit (return the item that
- look at the Did filterProc was hit to dismiss the
- event; return send "True?" dialog)
- TRUE to tell If so, dismiss
- ModalDialog that the dialog.
- this was a Otherwise, handle
- "triggering event", the event.
- otherwise return
- false.
-
- No doubt someone will have a correction or two to add to the above, but
- it should give you the general idea.
-
- Here's an example: if you want your filter procedure to do something
- on its own when the dialog is passed an update event, code it like this:
-
- (fragment from a filter procedure)
-
- switch (theEvent->what)
- {
- case (updateEvt):
- HandleUpdate(theDialog);
- return FALSE;
- /*Do not return an item hit value. Returning
- FALSE tells modalDialog to handle the update
- event. We have just added our own handling
- of the event. */
- break;
-
- where "HandleUpdate" is a routine of mine that draws on the dialog.
- Note that if your filter proc handles the event fully, and you don't want
- ModalDialog to even see it, you can clear the event, although this generally
- shouldn't be necessary since ModalDialog has useful default reactions to
- most events.
-
- >I assume that it
- >passes the dialog poointer/event record pointer/itemhit pointer, is this
- >true? It looks like its calling my filterProc constantly, if this is true
- >do I need handle events within the filterProc? Assuming all my parameters
- >are correct for filterProc are correct, what am I doing wrong?
-
- It is calling your filterProc constantly: every event goes through it.
-
- >
- >An explanation of how ModalDialog and the filterProc functions work with
- >each other would be nice.
- >
- >Thanks in advance
-
- I hope this helps some with your understanding of modal dialogs. I'm not
- sure how you should go about supporting a pop-up menu, but I tend to think
- that doing all the mouse tracking in the filter proc is the wrong approach.
- I was under the impression that there was pop-up support in the OS now.
- Can anyone confirm or deny? If not you may want to build a window and
- handle your own events from scratch, track the control, etc.
-
- >
- >Brian
-
-
- - --
- "It'sVerySad / toSeeTheAncientAndDistinguishedGameThatUsedToBe / aModelOf
- DecorumAndTranquilityBecomeLikeAnyOtherSportABattlegroundForRivalIdeologies
- toSlugItOutWithGlee." (from _Chess_). -potts@itl.itd.umich.edu-
-
- +++++++++++++++++++++++++++
-
- From: walkerj@math.scarolina.edu (Jim Walker)
- Date: 27 Aug 92 19:36:41 GMT
- Organization: USC Department of Computer Science
-
- In <1992Aug26.233800.21347@sagpd1> bberqu@sagpd1 () writes:
- ...
- >I'm trying to use ModalDialog with a filterProc function which will
- >handle popupmenus, when I call ModalDialog and just let it sit there
- >no mouse movement or anything, after a while, I get, I believe a system
- >error #26 according to MacsBug, all my filter proc function does is
- ...
-
- (Tried to mail, but it bounced.)
-
- You sure it wasn't error 28, stack collides with heap? That's probably
- what would happen if you were using C and forgot to declare the filterProc
- using the 'pascal' keyword, because ModalDialog would expect the filterProc
- to clean up the stack after itself, and a C routine expects the caller to
- clean up the stack.
- - --
-
- -- Jim Walker USC Dept. of Math. walkerj@math.scarolina.edu
-
- +++++++++++++++++++++++++++
-
- From: jeremyr@dcs.qmw.ac.uk (Jeremy Roussak)
- Date: 28 Aug 92 19:56:51 GMT
- Organization: Computer Science Dept, QMW, University of London
-
- In <1992Aug26.233800.21347@sagpd1> bberqu@sagpd1 writes:
-
- >I'm trying to use ModalDialog with a filterProc function which will
- >handle popupmenus, when I call ModalDialog and just let it sit there
- >no mouse movement or anything, after a while, I get, I believe a system
- >error #26 according to MacsBug, all my filter proc function does is
- >return (TRUE), I've also tried FALSE.
-
- 1. You are programming in C
- 2. You have forgotten to declare your filterproc as "pascal"
- 3. The error is really 28
-
- Just a wild guess...
-
- Jeremy
-
- +++++++++++++++++++++++++++
-
- From: cent@u.washington.edu (bob cent)
- Organization: university of washington
- Date: Fri, 18 Sep 1992 22:59:30 GMT
-
- I would like to learn how to change my b/w application icons to color, but have
- not found a good receipe to follow. I've fiddled a bit with 'cicn', but had no
- luck. Also, do the color icons work on os6 as well as os7?
-
- Thanks.
-
- Bob Cent, Engineering Technician
- cent@u.washington.edu
- Seattle, Washington
-
-
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-